package com.hand.springbootdemo.common;

/**
 * @author 13278
 */

public enum ResultCode {
    // 这些枚举都是在隐式调用枚举的构造方法，当调用无参构造方法时不需要括号
    OK(200, "操作成功"),
    ERROR(500, "操作失败"),
    BAD_REQUEST(400,"请求报文语法错误或者参数错误"),
    NOT_FOUND(404, "Not Found(资源未找到!)"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    FORBIDDEN(403, "没有相关权限!");

    private final Integer code;
    private final String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
